package com.chinasofti.shoot;

import java.awt.image.BufferedImage;

/**
 * 飞行物
 * 宽高坐标
 */
public abstract class FlyingObject {
    protected BufferedImage image;
    protected int width;
    protected int height;
    protected int x;
    protected int y;
    //飞行物移动
    public abstract void step();
    //判断飞行物越界
    public abstract boolean outOfBounds();
    //判断飞行物被子弹击中
    public boolean shootBy(Bullet bullet){
        int x= bullet.x, y=bullet.y,x1=this.x,y1=this.y,x2=this.x+this.width,y2=this.y+this.height;
        return x>x1 && x<x2 && y>y1 && y<y2;

    }
}
